package com.woniuxy.controller;

import com.woniuxy.entitys.TbUser;
import com.woniuxy.services.UserService;
import com.woniuxy.utils.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Classname UserController
 * @Date 2024/1/14 16:02
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/worker/addWoker")
    public ResultVO addWorker(@RequestBody Map<String,Object> map){
//前端返回的数据{phone=19811, rid=4}
        String phone = (String) map.get("phone");
        Integer rid = (Integer) map.get("rid");
        int i = userService.addUser(phone,rid);
        return i>0?ResultVO.success("success"):ResultVO.failure("error");

    }
}
